﻿using System.Linq;

namespace Ipmce.RemoteVoting.Common.Tools.CardReader.ImageParsing
{
	class FacialInformation : BdbData
	{
		public int FacialRecordDataLength
		{
			get { return GetInt(0, 4); }
			set { SetInt(0, 4, value); }
		}
		public int NumberOfFeaturePoints
		{
			get { return GetInt(4, 2); }
			set { SetInt(4, 2, value); }
		}

		public FacialInformation() : base(20) { }

		public FacialInformation(FacialRecordData facialRecordData)
			: base(20)
		{
			NumberOfFeaturePoints = facialRecordData.FeaturePoints.Count;
			FacialRecordDataLength = GetSize() +
			                         facialRecordData.FeaturePoints.Sum(p => p.GetSize()) +
			                         facialRecordData.ImageInformation.GetSize() +
			                         facialRecordData.ImageData.Length;
		}
	}
}